from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
import time

# frame切换   frame一个页面里面嵌套另外一个页面

driver = webdriver.Edge()

url = "https://wx.mail.qq.com/"

driver.get(url)

print(driver.find_element(By.PARTIAL_LINK_TEXT, "QQ邮箱").text)
time.sleep(2)
# 切换到frame页面，通过索引获取
driver.switch_to.frame(1)
# 通过name或id切换frame
driver.switch_to.frame("ptlogin_iframe")

time.sleep(2)
driver.find_element(By.ID,"u").send_keys("lyuetw")
time.sleep(2)
# 回到默认frame
driver.switch_to.default_content()
time.sleep(2)
print(driver.find_element(By.PARTIAL_LINK_TEXT, "QQ邮箱").text)


time.sleep(5)
driver.quit()